# Maintainer: Dan McGee <dan@archlinux.org>
# Contributor: Martin Striz <ms@poruba.net>

pkgname=irqbalance
pkgver=1.3.0
pkgrel=2
pkgdesc="IRQ balancing daemon for SMP systems"
arch=('x86_64')
url="https://github.com/Irqbalance/irqbalance"
license=('GPL')
backup=('etc/irqbalance.env')
depends=('glib2' 'numactl' 'libcap-ng' 'libsystemd')
makedepends=('systemd')
source=($pkgname-$pkgver.tar.gz::$url/archive/v$pkgver.tar.gz
        config.patch)
sha1sums=('2797747812d65fcfa83d7e3610857e6326df933a'
          'f5750dd9b53ef77c3dcb46ea70622c6c4d462888')

prepare() {
  cd "$srcdir/$pkgname-$pkgver"
  patch -p1 < ../config.patch
}

build() {
  cd "$srcdir/$pkgname-$pkgver"
  ./autogen.sh
  ./configure --prefix=/usr --sbindir=/usr/bin --with-systemd
  make
}

package() {
  cd "$srcdir/$pkgname-$pkgver"
  make install DESTDIR="$pkgdir"

  install -D -m644 misc/irqbalance.service "$pkgdir"/usr/lib/systemd/system/irqbalance.service
  install -D -m644 misc/irqbalance.env "$pkgdir"/etc/irqbalance.env

  # Disable udev rule until we clarify it FS#56785
  # install -D -m644 misc/90-irqbalance.rules "$pkgdir"/usr/lib/udev/rules.d/90-irqbalance.rules
}
